package com.shiguiwu.springmybatis.designpattern.bridge.pay.channel;

import com.shiguiwu.springmybatis.designpattern.bridge.pay.mode.IPayMode;
import lombok.extern.slf4j.Slf4j;

import java.math.BigDecimal;

/**
 * @description: 支付宝支付
 * @author: stone
 * @date: Created by 2021/8/24 14:05
 * @version: 1.0.0
 * @pakeage: com.shiguiwu.springmybatis.designpattern.bridge.pay.channel
 */
@Slf4j
public class ZfbPay extends Pay {

    public ZfbPay(IPayMode payMode) {
        super(payMode);
    }

    @Override
    public String transfer(String uId, String tradeId, BigDecimal amount) {
        log.info("模拟支付宝渠道支付划账开始。uId:{}, tradeId:{}, amount:{}", uId, tradeId, amount);
        boolean security = payMode.security(uId);
        if (!security) {
            log.info("模拟支付宝渠道支付风控校验。uId：{} tradeId：{} security： {}", uId, tradeId, security);
            return "0001";
        }
        log.info("模拟支付宝渠道⽀支付划账成功。uId：{} tradeId：{} amount：{}", uId, tradeId, amount);
        return "0000";
    }
}
